import { Component, Input, OnInit } from '@angular/core';

@Component({
  selector: 'app-image-view',
  templateUrl: './image-view.component.html',
  styleUrls: ['./image-view.component.less']
})
export class ImageViewComponent implements OnInit {

  @Input() data: any[];
  @Input() thumbnailHeight: string;
  isVisible: boolean = false;
  index: number = -1;
  divHeight = (window.innerHeight - 200) + 'px';

  previous() {
    if (this.index > 0)
      this.index--;
  }

  next() {
    if (this.index < this.data.length - 1)
      this.index++;
  }

  open(index: number) {
    this.isVisible = true;
    this.index = index;
  }

  close() {
    this.isVisible = false;
  }

  constructor() { }

  ngOnInit() {
  }

}
